package com.ykt.controller;

import java.util.List;

import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.ykt.model.MarketCategory;

@ControllerBind(controllerKey="/marketCategory")
public class MarketCategoryController extends BaseController<MarketCategory> {

	public MarketCategoryController() {
		super(MarketCategory.class);
	}
	
	public void comboboxMarket() {
        int id = getParaToInt(0, 0);

        List<Record> list = null;
        String sql = "SELECT c.* FROM category c LEFT JOIN market_category m ON c.id = m.category_id WHERE m.market_id = " + id;
        list = Db.find(sql);

        this.renderJson(list);
    }
	
}
